<template>
	<view class="content">
		<view class="order_one" @tap="orderDetails(item.id)" v-for="(item,index) in orderlist" :key='index'>
			<view class="order_one_left" v-for="(item1,index1) in item.goods" :key='index1'>
				<image :src="item1.goods_image" mode=""></image>
				<view class="order_one_text">
					<view class="order_ones">
						<text>{{item1.goods_name}}</text>
						<text class="price">￥{{item1.price}}</text>
					</view>
					<view class="order_ones">
						<text class="gg">{{item1.ertitle}}</text>
						<text class="gg">X{{item1.num}}</text>
					</view>
				</view>
			</view>
			<!-- <view class="order_one_left">
				<image src="../../../static/images/a7.png" mode=""></image>
				<view class="order_one_text">
					<view class="order_ones">
						<text>马来西亚猫山王榴莲1个装</text>
						<text class="price">￥269</text>
					</view>
					<view class="order_ones">
						<text class="gg">规格：1.8-2.2kg（液氮冷冻）</text>
						<text class="gg">X2</text>
					</view>
				</view>
			</view> -->
			<view class="order_one_item">
				<!-- <view class="order_one_yf">
					<text>运费</text>
					<text class="gg">￥0.00</text>
				</view> -->
				<view class="order_one_yf">
					<text>备注</text>
					<text class="gg">{{item.buyer_message}}</text>
				</view>
			</view>
			<view class="order_one_sh">
				<view class="order_sh">
					<text @click="receipt">{{status[item.order_status]}}</text>
					<!-- <text>退款</text> -->
				</view>
				<view class="order_qrs">
					<!-- <text>共计3件</text> -->
					<text class="zj"><text class="hj">合计</text>￥{{item.order_money}}</text>
				</view>
			</view>
		</view>
		<!-- <view class="order_one">
			<view class="order_one_left">
				<image src="../../../static/images/a7.png" mode=""></image>
				<view class="order_one_text">
					<view class="order_ones">
						<text>马来西亚猫山王榴莲1个装</text>
						<text class="price">￥269</text>
					</view>
					<view class="order_ones">
						<text class="gg">规格：1.8-2.2kg（液氮冷冻）</text>
						<text class="gg">X2</text>
					</view>
				</view>
			</view>
			<view class="order_one_left">
				<image src="../../../static/images/a7.png" mode=""></image>
				<view class="order_one_text">
					<view class="order_ones">
						<text>马来西亚猫山王榴莲1个装</text>
						<text class="price">￥269</text>
					</view>
					<view class="order_ones">
						<text class="gg">规格：1.8-2.2kg（液氮冷冻）</text>
						<text class="gg">X2</text>
					</view>
				</view>
			</view>
			<view class="order_one_item">
				<view class="order_one_yf">
					<text>运费</text>
					<text class="gg">￥0.00</text>
				</view>
				<view class="order_one_yf">
					<text>备注</text>
					<text class="gg">无</text>
				</view>
			</view>
			<view class="order_one_sh">
				<view class="order_sh">
					<text>申请售后</text>
				</view>
				<view class="order_qrs">
					<text>共计3件</text>
					<text class="zj"><text class="hj">合计</text>￥567.9</text>
				</view>
			</view>
		</view>
		
		
		<view class="order_one">
			<view class="order_one_left">
				<image src="../../../static/images/a7.png" mode=""></image>
				<view class="order_one_text">
					<view class="order_ones">
						<text>马来西亚猫山王榴莲1个装</text>
						<text class="price">￥269</text>
					</view>
					<view class="order_ones">
						<text class="gg">规格：1.8-2.2kg（液氮冷冻）</text>
						<text class="gg">X2</text>
					</view>
				</view>
			</view>
			<view class="order_one_left">
				<image src="../../../static/images/a7.png" mode=""></image>
				<view class="order_one_text">
					<view class="order_ones">
						<text>马来西亚猫山王榴莲1个装</text>
						<text class="price">￥269</text>
					</view>
					<view class="order_ones">
						<text class="gg">规格：1.8-2.2kg（液氮冷冻）</text>
						<text class="gg">X2</text>
					</view>
				</view>
			</view>
			<view class="order_one_item">
				<view class="order_one_yf">
					<text>运费</text>
					<text class="gg">￥0.00</text>
				</view>
				<view class="order_one_yf">
					<text>备注</text>
					<text class="gg">无</text>
				</view>
			</view>
			<view class="order_one_sh">
				<view class="order_sh">
					<text>待支付</text>
				</view>
				<view class="order_qrs">
					<text>共计3件</text>
					<text class="zj"><text class="hj">合计</text>￥567.9</text>
				</view>
			</view>
		</view>
		<view class="order_one">
			<view class="order_one_left">
				<image src="../../../static/images/a7.png" mode=""></image>
				<view class="order_one_text">
					<view class="order_ones">
						<text>马来西亚猫山王榴莲1个装</text>
						<text class="price">￥269</text>
					</view>
					<view class="order_ones">
						<text class="gg">规格：1.8-2.2kg（液氮冷冻）</text>
						<text class="gg">X2</text>
					</view>
				</view>
			</view>
			<view class="order_one_left">
				<image src="../../../static/images/a7.png" mode=""></image>
				<view class="order_one_text">
					<view class="order_ones">
						<text>马来西亚猫山王榴莲1个装</text>
						<text class="price">￥269</text>
					</view>
					<view class="order_ones">
						<text class="gg">规格：1.8-2.2kg（液氮冷冻）</text>
						<text class="gg">X2</text>
					</view>
				</view>
			</view>
			<view class="order_one_item">
				<view class="order_one_yf">
					<text>运费</text>
					<text class="gg">￥0.00</text>
				</view>
				<view class="order_one_yf">
					<text>备注</text>
					<text class="gg">无</text>
				</view>
			</view>
			<view class="order_one_sh">
				<view class="order_sh">
					<text>已退款</text>
				</view>
				<view class="order_qrs">
					<text>共计3件</text>
					<text class="zj"><text class="hj">合计</text>￥567.9</text>
				</view>
			</view>
		</view>
		<view class="order_one">
			<view class="order_one_left">
				<image src="../../../static/images/a7.png" mode=""></image>
				<view class="order_one_text">
					<view class="order_ones">
						<text>马来西亚猫山王榴莲1个装</text>
						<text class="price">￥269</text>
					</view>
					<view class="order_ones">
						<text class="gg">规格：1.8-2.2kg（液氮冷冻）</text>
						<text class="gg">X2</text>
					</view>
				</view>
			</view>
			<view class="order_one_left">
				<image src="../../../static/images/a7.png" mode=""></image>
				<view class="order_one_text">
					<view class="order_ones">
						<text>马来西亚猫山王榴莲1个装</text>
						<text class="price">￥269</text>
					</view>
					<view class="order_ones">
						<text class="gg">规格：1.8-2.2kg（液氮冷冻）</text>
						<text class="gg">X2</text>
					</view>
				</view>
			</view>
			<view class="order_one_item">
				<view class="order_one_yf">
					<text>运费</text>
					<text class="gg">￥0.00</text>
				</view>
				<view class="order_one_yf">
					<text>备注</text>
					<text class="gg">无</text>
				</view>
			</view>
			<view class="order_one_sh">
				<view class="order_sh">
					<text>已售后</text>
				</view>
				<view class="order_qrs">
					<text>共计3件</text>
					<text class="zj"><text class="hj">合计</text>￥567.9</text>
				</view>
			</view>
		</view> -->

	<!-- <view class="wdd"style="text-align: center;">
	 	<image src="../../../static/images/a13.png" mode=""></image>
	 </view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				"orderlist":[],
				'status':['未支付','已支付代配送','配送中','已到达','已收货','申请售后','售后完成'],
				courrt:1,
				bs:1,
				order_status:''
			};
		},
		methods: {
			//获取订单列表
			orderlists(){
				this.$ajax(
					this.apiList.orderList,
					{
						status:this.order_status
					},
					'POST'
					).then(res=>{
						this.orderlist = res.data
				})
			},
			orderDetails(id){
				uni.navigateTo({
					url:'../orderDetails/orderDetails?id='+id
				})
			},
			//申请退款
			refund(){
				uni.navigateTo({
					url:'../refund/refund'
				})
			},
			// receipt() {
			// 	uni.showModal({
			// 		content: '是否确认收货',
			// 		success(res) {
			// 			if (res.confirm) {
			// 				console.log('用户点击确定');
							
			// 			} else if (res.cancel) {
			// 				console.log('用户点击取消');
			// 			} 
			// 		}
			// 	})
			// }
		},
		onLoad(options) {
			this.order_status = options.order_status
		
		},
		onReady(){
			if(this.order_status == -1 ){
				uni.setNavigationBarTitle({
				    title: '待支付'
				});
			}else if(this.order_status == 1){
				uni.setNavigationBarTitle({
				    title: '待收货'
				});
			}else if(this.order_status == 3){
				uni.setNavigationBarTitle({
				    title: '已完成'
				});
			}else if(this.order_status == 4){
				uni.setNavigationBarTitle({
				    title: '售后/退款'
				});
			}
			},
		onShow() {
			this.orderlists()
		},
		onReachBottom() {
			if (this.bs) {
				this.$ajax(
					this.apiList.orderList, {
						page: ++this.courrt,
						status:this.order_status
					},
					'POST',
				).then(res => {
					this.orderlist = this.orderlist.concat(res.data)
					if (!res.data.length) {
						this.bs = 0;
						this.$sToast('无更多数据')
					};
				})
			}
		},
	}
</script>
<style lang="scss">
	.content {
		background: #F5F5F5;
		height: 100vh;
		.wdd{
			image{
				width: 418rpx;
				height: 430rpx;
				margin-top: 30%;
			}
		}
		.order_one {
			margin: 20rpx;
			background: #fff;
			border-radius: 15rpx;
			.order_one_left {
				display: flex;
				padding: 20rpx;

				image {
					width: 128rpx;
					height: 128rpx;
				}

				.order_one_text {
					width: 80%;

					font-size: 24rpx;
					color: #212121;
					font-weight: 400;
					font-family: PingFang SC;

					text {
						display: block;
					}

					.order_ones {
						display: flex;
						justify-content: space-between;
						width: 100%;
						padding-bottom: 20rpx;
					}

					.price {
						color: red;
					}

					.gg {
						color: #BDBDBD;
						font-size: 20rpx;
					}
				}
			}

			.order_one_yf {
				display: flex;
				justify-content: space-between;
				padding: 20rpx 20rpx 10rpx 20rpx;

				text {
					font-size: 20rpx;
				}

				.gg {
					color: #BDBDBD;
				}
			}

			.order_one_sh {
				display: flex;
				justify-content: space-between;
				padding: 20rpx 20rpx 10rpx 20rpx;

				.order_sh {
					text {
						color: #FCBB21;
						font-size: 24rpx;
						border: 1px solid #FCBB21;
						padding: 5rpx 20rpx;
						border-radius: 20rpx;
						margin-right: 20rpx;
					}
				}

				.order_qrs {
					text {
						color: #BDBDBD;
					}

					.zj {
						padding-left: 10rpx;
						font-size: 28rpx;
						color: red;

						.hj {
							font-size: 28rpx;
							color: #212121;
						}
					}
				}

				text {
					font-size: 24rpx;
				}
			}
		}
	
	}
</style>
